import { createApp } from "vue";
import { createPinia } from "pinia";
import App from "./App.vue";
import Antd from "ant-design-vue";
import { createRouter, createWebHistory } from "vue-router";
import i18n from "./component/i18n";

const app = createApp(App);

const pinia = createPinia();
app.use(pinia);

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/index",
      component: () => import("@/Index.vue"),
      children: [
        {
          path: "my-model",
          component: () => import("@/my/MyModel.vue"),
        },
        {
          path: "my-model-record",
          component: () => import("@/my/MyModelRecord.vue"),
        },
        {
          path: "record-version",
          component: () => import("@/my/RecordVersion.vue"),
        },
        {
          path: "share-model",
          component: () => import("@/share/ShareModel.vue"),
        },
        {
          path: "share-model-record",
          component: () => import("@/share/ShareModelRecord.vue"),
        },
        {
          path: "event-log",
          component: () => import("@/profile/EventLog.vue"),
        },
        {
          path: "my-log",
          component: () => import("@/profile/MyLog.vue"),
        },
        {
          path: "my-message",
          component: () => import("@/profile/MyMessage.vue"),
        },
        {
          path: "profile",
          component: () => import("@/profile/MyProfile.vue"),
        },
        {
          path: "my-query",
          component: () => import("@/my/MyQuery.vue"),
        },
        {
          path: "my-trash",
          component: () => import("@/my/MyTrash.vue"),
        },
      ],
    },
    {
      path: "/login",
      component: () => import("@/login/Login.vue"),
    },
    {
      path: "/admin",
      component: () => import("@/admin/AdminIndex.vue"),
      children: [
        {
          path: "statics",
          component: () => import("@/admin/Statistics.vue"),
        },
        {
          path: "db-tool",
          component: () => import("@/admin/DbTool.vue"),
        },
        {
          path: "backup-tool",
          component: () => import("@/admin/BackupTool.vue"),
        },
      ],
    },
  ],
});
app.use(router);

app.use(Antd);

app.use(i18n);

app.mount("#app");
